/**
 * 
 */
package com.maohi.software.tupuna.providers;

import com.google.inject.Provider;
import com.maohi.software.arii.Arii;
import com.maohi.software.tupuna.Page;
import com.maohi.software.tupuna.interfaces.TupunaController;

/**
 * @author heifara
 * 
 */
public class PageProvider implements Provider<Page> {

	private String pageTitle;

	public PageProvider() {
	}

	public PageProvider(String aTitle) {
		this.pageTitle = aTitle;
	}

	@Override
	public Page get() {
		TupunaController iController = Arii.getInstance(TupunaController.class);
		if (pageTitle != null && !pageTitle.isEmpty()) {
			return iController.getPage(pageTitle);
		} else {
			return iController.newPage();
		}
	}

}
